package com.warrior.entity;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by Shawn on 2017/3/15.
 */
@Entity
@Table(name = "activity_content", schema = "warrior")
public class ActivityContentEntity {
    private String id;//活动信息id,用AC-32位UUID 表示
    private String activityText;//记录活动文本信息
    private String activityPicPath;//记录图片上传的路径
    private String activityVideoPath;//记录活动宣传视频的上传路径
    private Integer activitySequence;//记录活动序列,越小排名越往上
    private Timestamp createdAt;//记录该条记录的创建时间
    private Timestamp updateAt;//记录该条记录的更新时间
    private String createdBy;//记录该条记录的创建者
    private String updateBy;//记录该条记录由何人更新
    private ActivityEntity activityByActivityId;//记录活动id

    @Id
    @Column(name = "id")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "activity_text")
    public String getActivityText() {
        return activityText;
    }

    public void setActivityText(String activityText) {
        this.activityText = activityText;
    }

    @Basic
    @Column(name = "activity_pic_path")
    public String getActivityPicPath() {
        return activityPicPath;
    }

    public void setActivityPicPath(String activityPicPath) {
        this.activityPicPath = activityPicPath;
    }

    @Basic
    @Column(name = "activity_video_path")
    public String getActivityVideoPath() {
        return activityVideoPath;
    }

    public void setActivityVideoPath(String activityVideoPath) {
        this.activityVideoPath = activityVideoPath;
    }

    @Basic
    @Column(name = "activity_sequence")
    public Integer getActivitySequence() {
        return activitySequence;
    }

    public void setActivitySequence(Integer activitySequence) {
        this.activitySequence = activitySequence;
    }

    @Basic
    @Column(name = "created_at")
    public Timestamp getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Timestamp createdAt) {
        this.createdAt = createdAt;
    }

    @Basic
    @Column(name = "update_at")
    public Timestamp getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(Timestamp updateAt) {
        this.updateAt = updateAt;
    }

    @Basic
    @Column(name = "created_by")
    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    @Basic
    @Column(name = "update_by")
    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ActivityContentEntity that = (ActivityContentEntity) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (activityText != null ? !activityText.equals(that.activityText) : that.activityText != null) return false;
        if (activityPicPath != null ? !activityPicPath.equals(that.activityPicPath) : that.activityPicPath != null)
            return false;
        if (activityVideoPath != null ? !activityVideoPath.equals(that.activityVideoPath) : that.activityVideoPath != null)
            return false;
        if (activitySequence != null ? !activitySequence.equals(that.activitySequence) : that.activitySequence != null)
            return false;
        if (createdAt != null ? !createdAt.equals(that.createdAt) : that.createdAt != null) return false;
        if (updateAt != null ? !updateAt.equals(that.updateAt) : that.updateAt != null) return false;
        if (createdBy != null ? !createdBy.equals(that.createdBy) : that.createdBy != null) return false;
        if (updateBy != null ? !updateBy.equals(that.updateBy) : that.updateBy != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (activityText != null ? activityText.hashCode() : 0);
        result = 31 * result + (activityPicPath != null ? activityPicPath.hashCode() : 0);
        result = 31 * result + (activityVideoPath != null ? activityVideoPath.hashCode() : 0);
        result = 31 * result + (activitySequence != null ? activitySequence.hashCode() : 0);
        result = 31 * result + (createdAt != null ? createdAt.hashCode() : 0);
        result = 31 * result + (updateAt != null ? updateAt.hashCode() : 0);
        result = 31 * result + (createdBy != null ? createdBy.hashCode() : 0);
        result = 31 * result + (updateBy != null ? updateBy.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "activity_id", referencedColumnName = "id", nullable = false)
    public ActivityEntity getActivityByActivityId() {
        return activityByActivityId;
    }

    public void setActivityByActivityId(ActivityEntity activityByActivityId) {
        this.activityByActivityId = activityByActivityId;
    }
}
